#pragma once
// -------------------------------------------------
// BlinKit - BlinKit Library
// -------------------------------------------------
//   File Name: page_popup_host_window.h
// Description: PagePopupHostWindow Class
//      Author: Ziming Li
//     Created: 2022-04-27
// -------------------------------------------------
// Copyright (C) 2022 MingYang Software Technology.
// -------------------------------------------------

#ifndef BLINKIT_WEB_PAGE_POPUP_WINDOW_H
#define BLINKIT_WEB_PAGE_POPUP_WINDOW_H

#include "blinkit/win/web_page_host_window.h"

namespace blink {
class WebPagePopup;
}

namespace BlinKit {

class WebViewHostWindow;

class PagePopupHostWindow final : public WebPageHostWindow
{
public:
    PagePopupHostWindow(WebPage &page);
#ifndef NDEBUG
    ~PagePopupHostWindow(void) override;
#endif

    using WebPageHostWindow::AttachHWND;

    bool ProcessMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT &result);
private:
    WebPagePopup* GetWebPagePopup(void) const;
    WebViewHostWindow* OwnerHostWindow(void) const;

    BOOL OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct);
    void OnDestroy(HWND hwnd);
    void OnSize(HWND hwnd, UINT state, int cx, int cy);

    void SetWindowRect(const IntRect &rect) override;
    void Show(void) override;
    void Close(void) override;
};

} // namespace BlinKit

#endif // BLINKIT_WEB_PAGE_POPUP_WINDOW_H
